﻿using System.Web.Script.Serialization;

namespace SBToolkit.Web
{
    /// <summary>
    /// Converts .NET types.
    /// </summary>
    public static class Converter
    {
        /// <summary>
        /// Serializes specified object to JSON.
        /// </summary>
        /// <param name="obj">The object to serialize.</param>
        /// <returns>JSON object.</returns>
        public static string ToJson(this object obj)
        {
            var serializer = new JavaScriptSerializer();

            return serializer.Serialize(obj);
        }
    }
}
